/*
 * CampoMinado.java
 *
 * Created on 27/11/2010, 01:47:04
 */
package campo;

import Objetos.Node;
import java.awt.Color;
import java.awt.Dimension;

/**
 *
 * @author KilleR
 */
public class CampoMinado extends javax.swing.JFrame {

    int largura = 25;
    int altura = 25;

    /** Creates new form CampoMinado */
    public CampoMinado(int x, int y) {
        this.setVisible(true);
        Dimension d = new Dimension();

        int dx = x * largura + 26;
        int dy = y * largura + 47;
        d.setSize(dx, dy);
        //d.setSize(276, 297);
        setMaximumSize(d);
        setSize(d);
        setMaximumSize(d);
        initComponents();
        this.setLocationRelativeTo(null);
        init2(x, y);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(5, 5));
        getContentPane().setLayout(null);
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        int x = 5;
        int y = 5;
        CampoMinado cm = new CampoMinado(x, y);
    }

    private void init2(int paramx, int paramy) {
        int xcount = 1;
        int ycount = 1;
        int xinit = 5;
        int yinit = 5;
        int x = xinit;
        int y = yinit;
        for (int horizontal = 0; horizontal < paramx; horizontal++) {
            for (int vertical = 0; vertical < paramy; vertical++) {
                Node node = new Node();
                node.setFont(new java.awt.Font("Times New Roman", 0, 12));
                node.setBorder(new javax.swing.border.LineBorder(Color.gray));
                getContentPane().add(node);
                node.setBounds(x, y, largura, altura);
                node.addActionListener(new Listenerzao(node));
                x = x + largura;
                ycount++;
            }
            xcount++;
            x = xinit;
            y = y + altura;
        }
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
